# -*- makefile -*-

COMMON_CFLAGS	= -mrtd -mregparm=3

# Modules.
pkglib_MODULES = kernel.mod halt.mod reboot.mod suspend.mod		\
	aout.mod serial.mod linux.mod		\
	nand.mod memdisk.mod pci.mod lspci.mod datetime.mod	\
	date.mod datehook.mod lsmmap.mod mmap.mod ofw_fb.mod

# For kernel.mod.
kernel_mod_SOURCES = kern/i386/ieee1275/startup.S \
	kern/i386/misc.S \
	kern/i386/ieee1275/init.c \
	kern/ieee1275/init.c \
	kern/ieee1275/mmap.c \
	kern/ieee1275/cmain.c kern/ieee1275/openfw.c \
	kern/main.c kern/device.c \
	kern/disk.c kern/dl.c kern/file.c kern/fs.c kern/err.c \
	kern/misc.c kern/mm.c kern/term.c \
	kern/rescue_parser.c kern/rescue_reader.c \
	kern/parser.c kern/partition.c \
	kern/env.c \
	kern/time.c kern/list.c kern/handler.c kern/command.c kern/corecmd.c \
	kern/generic/millisleep.c \
	kern/ieee1275/ieee1275.c \
	term/ieee1275/ofconsole.c \
	disk/ieee1275/ofdisk.c
kernel_mod_CFLAGS = $(COMMON_CFLAGS)
kernel_mod_LDFLAGS = $(COMMON_LDFLAGS)

# Scripts.
sbin_SCRIPTS = grub-install

# For grub-install.
grub_install_SOURCES = util/ieee1275/grub-install.in

# Modules.
pkglib_MODULES = kernel.mod halt.mod suspend.mod		\
	aout.mod linux.mod	\
	nand.mod datetime.mod	\
	mmap.mod

# For mmap.mod.
mmap_mod_SOURCES = mmap/mmap.c mmap/i386/uppermem.c mmap/i386/mmap.c
mmap_mod_CFLAGS = $(COMMON_CFLAGS)
mmap_mod_LDFLAGS = $(COMMON_LDFLAGS)
mmap_mod_ASFLAGS = $(COMMON_ASFLAGS)

# For aout.mod.
aout_mod_SOURCES = loader/aout.c
aout_mod_CFLAGS = $(COMMON_CFLAGS)
aout_mod_LDFLAGS = $(COMMON_LDFLAGS)

# For suspend.mod
suspend_mod_SOURCES = commands/ieee1275/suspend.c
suspend_mod_CFLAGS = $(COMMON_CFLAGS)
suspend_mod_LDFLAGS = $(COMMON_LDFLAGS)

# For halt.mod
halt_mod_SOURCES = commands/halt.c
halt_mod_CFLAGS = $(COMMON_CFLAGS)
halt_mod_LDFLAGS = $(COMMON_LDFLAGS)

# For linux.mod.
linux_mod_SOURCES = loader/i386/ieee1275/linux.c
linux_mod_CFLAGS = $(COMMON_CFLAGS)
linux_mod_LDFLAGS = $(COMMON_LDFLAGS)

# For nand.mod.
nand_mod_SOURCES = disk/ieee1275/nand.c
nand_mod_CFLAGS = $(COMMON_CFLAGS)
nand_mod_LDFLAGS = $(COMMON_LDFLAGS)

# For datetime.mod
datetime_mod_SOURCES = lib/cmos_datetime.c
datetime_mod_CFLAGS = $(COMMON_CFLAGS)
datetime_mod_LDFLAGS = $(COMMON_LDFLAGS)

include $(srcdir)/conf/i386.mk
include $(srcdir)/conf/common.mk
